<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div id="app">
        <span><router-link to="/login">登录</router-link></span>
        <span><router-link to="/register">注册</router-link></span>
        <hr/>
        <div>
            <router-view></router-view>
        </div>
    </div>
</body>
<script src="node_modules/vue/dist/vue.js"></script>
<script src="node_modules/vue-router/dist/vue-router.js"></script>
<script src="js/register.js"></script>
<script src="js/login.js"></script>
<script>

    // 创建vue-router对象
    const router = new VueRouter({
        routes:[
            {
                path:'/login',  // 请求路径   以“/”开头
                component:loginForm   // 组件名称
            },
            {
                path:'/register',
                component:registerForm
            }
        ]
    });

    const  vm = new Vue({
        el:"#app",
        components:{
            loginForm,
            registerForm
        },
        router // 引用上面定义的路由
    });
</script>
</html>